module.exports = function (config) {
    const { baseURL } = config

    return function (Vue) {
        Vue.prototype.$http = async function (params) {
            const { url, header, method, data } = params
            uni.showLoading({ title: '正在加载中', mask: true })
            const res = await uni.request({
                url: baseURL + url,
                data,
                header,
                method
            })
            uni.hideLoading()
            return res[1]
        }
    }

}